package Untils;

import com.mchange.v2.c3p0.ComboPooledDataSource;

import java.beans.PropertyVetoException;
import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by Administrator on 2017/9/18.
 */
public class C3P0Untils {
    private static ComboPooledDataSource com=null;
    static {
        com=new ComboPooledDataSource();
        try {
            com.setDriverClass("com.mysql.jdbc.Driver");
            com.setJdbcUrl("jdbc:mysql://localhost:3306/jdbc");
            com.setUser("root");
            com.setPassword("root");
            com.setMaxPoolSize(15);
            com.setMinPoolSize(5);
        } catch (PropertyVetoException e) {
            e.printStackTrace();
        }

    }
    public static Connection getConetion() throws SQLException {
        return com.getConnection();
    }
    public static ComboPooledDataSource getDataSources()
    {
        return com;
    }
}
